<script type="text/javascript"><!--//--><![CDATA[//><!--

 	$(document).ready(function() {
		<?php
 			if (isset($receive_toko_auto)) {
 				?>
 			var receive_toko_auto = "<?php echo $receive_toko_auto; ?>";
 				<?php
 			};
 		?>
		// Setup Form
		$('#form_master').setupForm([
			{ name: 'receive_toko_cabang', type: 'text', size: 'long', data: <?php echo json_encode($combocabang); ?> },
			{ name: 'receive_toko_no', type: 'text', size: 'long', maxlength: 255},
			{ name: 'supplier_nama', type: 'text', size: 'long',data: <?php echo json_encode($combopetugas); ?> },
			{ name: 'receive_toko_status', type: 'text', size: 'long', maxlength: 255},
			{ name: 'receive_toko_tgl', type: 'date', size: 'short', maxlength: 255 },
			{ name: 'receive_toko_gudang', type: 'text', size: 'long', maxlength: 255},
		], <?php echo json_encode($data); ?>);
        
		
        <?php if($mode=="edit"){ ?>
        $('#receive_toko_no').readonly();
        $('#receive_toko_tgl').readonly();

        <?php } ?>
		
		// Set Action Button
		var buttons = [{ label: 'Save', icon: 'save', onclick: function() { 
							$('#form_master').submitForm(	'/'+controller+'/ajax_post', 
							{ detail:[	{ table: 'dtl_sample2', field:['receive_toko_dt_id','receive_toko_no','receive_toko_dt_barang','receive_toko_dt_barcode','receive_toko_dt_kemasan','receive_toko_dt_ckemasan','receive_toko_dt_cckemasan','receive_toko_dt_pesan','receive_toko_dt_kirim','receive_toko_dt_terima','receive_toko_dt_hpokok','receive_toko_dt_hjual','receive_toko_dt_diskon','receive_toko_dt_ppn','receive_toko_dt_terima2','receive_toko_dt_catatan']}], 
							onComplete : function(data){ eval('oData = '+data); loadPage('/'+controller+'/Index'); } //loadPage('/'+controller+'/edit/?return_toko_id='+(oData.genid!='' ? oData.genid : $('#return_toko_id').getval()))
														      } 
														); 
						}},
					   { label: 'Close', icon: 'cancel', onclick: function() { loadPage('/'+controller+'/Index'); } }];
		setAction(buttons);
		
		// Create Tab
		$('#tt').tabs({ border:false });  
		
		// Focus at First Object
				<?php
 			if (isset($receive_toko_auto)) {
 				?>
		$('#receive_toko_no').setval(receive_toko_auto);
		$('#receive_toko_no').readonly(true);
 				<?php
 			};
 		?>

		$('#form_master').focusFirst();

		
    });




//--><!]]></script>

<div id="form_master_message" style="display:none;"></div>
    <table class="tb_form" style="display:none;" cellpadding="0" cellspacing="0">
    <tr>
        <td >Nama Cabang</td>
        <td><input id="receive_toko_cabang" /></td>
        <td >Petugas</td>
        <td><input id="supplier_nama" /></td>
        <td><input type="hidden" id="receive_toko_id" value="<?php echo $data['receive_toko_id'];?>"/></td>
    </tr>
    <tr>
        <td >No Permintaan</td>
        <td ><input id="receive_toko_no" /></td>
         <td >Tanggal</td>
        <td ><input id="receive_toko_tgl" /></td>
    </tr>
    <tr>
        <td >Status Toko</td>
         <td ><select id="receive_toko_status" name="receive_toko_status">
        		<option value="Receive" name="receive">Receive</option>
        		<option value="Not Receive" name="not receive">Not Receive</option>
        	 </select></td>
    </tr>
    </table>
    <div id="tt" class="easyui-tabs" style="min-height:400px;">  
	    <div title="Detail Order Receive" style="overflow:auto;padding:10px;">  
	    	<?php require_once('formdtl.php'); ?>
	    </div>	
	</div>
